package net.melon.product.pojo;

import java.util.ArrayList;
import java.util.List;

import net.esj.basic.pojo.AbstractPojo;
import net.melon.sysres.pojo.SysValue;

public class ProductAttribute extends AbstractPojo<Long>{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -1095875783083266146L;

	public static enum ATTRIBUTE_TYPE{
		
		TEXT(1)/*,
		SELECT(2)*/;
		
		private int type;

		private ATTRIBUTE_TYPE(int type) {
			this.type = type;
		}

		public int getType() {
			return type;
		}
		
		public static ATTRIBUTE_TYPE valueOf(int state){
			
			for(ATTRIBUTE_TYPE st : values()){
				if(st.getType() == state){
					return st;
				}
			}
			
			return null;
		}
	}
	
	public static enum ATTRIBUTE_UNIT{
		
		NUMBER(1),STRING(2);
		
		private int unit;

		private ATTRIBUTE_UNIT(int unit) {
			this.unit = unit;
		}

		public int getUnit() {
			return unit;
		}
		
		public static ATTRIBUTE_UNIT valueOf(int unit){
			
			for(ATTRIBUTE_UNIT st : values()){
				if(st.getUnit() == unit){
					return st;
				}
			}
			
			return null;
		}
	}
	public static enum ATTRIBUTE_REQUIRED{
		
		YES(1),NO(2);
		
		private int required;

		private ATTRIBUTE_REQUIRED(int required) {
			this.required = required;
		}

		public int getRequired() {
			return required;
		}
		
		public static ATTRIBUTE_REQUIRED valueOf(int required){
			
			for(ATTRIBUTE_REQUIRED st : values()){
				if(st.getRequired() == required){
					return st;
				}
			}
			
			return null;
		}
	}
	
	
	private Long id;
	
	private Long typeId;
	
	private String name;
	
	private int type;//类型
	
	private int state;//状态
	
	private String selectValue;//选择项
	
	private int unit;//单位
	
	private int required;//是否必填 1,2 
	
	public static List<SysValue> TYPES = new ArrayList<SysValue>();
	
	public static List<SysValue> REQUIREDS = new ArrayList<SysValue>();
	
	public static List<SysValue> UNITS = new ArrayList<SysValue>();
	
	private List<SysValue> selectValueList = new ArrayList<SysValue>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getSelectValue() {
		return selectValue;
	}

	public void setSelectValue(String selectValue) {
		this.selectValue = selectValue;
	}

	public int getUnit() {
		return unit;
	}

	public void setUnit(int unit) {
		this.unit = unit;
	}

	public int getRequired() {
		return required;
	}

	public void setRequired(int required) {
		this.required = required;
	}

	public Long getTypeId() {
		return typeId;
	}

	public void setTypeId(Long typeId) {
		this.typeId = typeId;
	}

	public List<SysValue> getSelectValueList() {
		return selectValueList;
	}

	public void setSelectValueList(List<SysValue> selectValueList) {
		this.selectValueList = selectValueList;
	}
	
}
